package com.yyx.beautifylib.model;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;

import com.yyx.beautifylib.ui.activity.BLReliefActivity;
import com.yyx.beautifylib.ui.activity.BLSharpenActivity;
import com.yyx.beautifylib.utils.ActivityUtils;

/**
 * @Desc:锐化参数
 * @Author:  86133
 * @Time:  2020/4/11
 */
public class BLSharpenParam implements Parcelable {
    public static final String KEY = "sharpen";
    public static final int REQUEST_CODE_SHARPEN = 0x0121;
    private String path;
    public static Bitmap bitmap;

    public BLSharpenParam(){}

    public BLSharpenParam(String path) {
        this.path = path;
    }


    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public static void recycleBitmap(){
        if (bitmap != null){
            bitmap.recycle();
            bitmap = null;
        }
    }

    public static void startActivity(Activity activity, BLSharpenParam param){
        Intent intent = new Intent(activity, BLSharpenActivity.class);
        intent.putExtra(BLSharpenParam.KEY, param);
        ActivityUtils.startActivityForResult(activity, intent, BLSharpenParam.REQUEST_CODE_SHARPEN);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.path);
    }

    protected BLSharpenParam(Parcel in) {
        this.path = in.readString();
    }

    public static final Creator<BLSharpenParam> CREATOR = new Creator<BLSharpenParam>() {
        @Override
        public BLSharpenParam createFromParcel(Parcel source) {
            return new BLSharpenParam(source);
        }

        @Override
        public BLSharpenParam[] newArray(int size) {
            return new BLSharpenParam[size];
        }
    };
}
